# -*- coding:utf-8 -*-
import os
import paramiko  
import urllib    
import urllib.request  

def __init__ (self, config_file):  
    self.__config_file = config_file

def testDeploy(self):
    KEY_MAVEN_HOME = 'MAVEN_HOME'  
    MAVEN_HOME = os.getenv(KEY_MAVEN_HOME)  
    print(MAVEN_HOME)
    if (MAVEN_HOME == None):  
        print ('没有配置环境变量[' + KEY_MAVEN_HOME + ']')  
        os._exit(0) 

def SSHClient(): 
    # 检测是否成功
    APP_TEST_URL = 'http://192.168.18.239:8080/acaomei-skype/login/loginTest.do'
    try:
        print ('connectionning', APP_TEST_URL, '....')
        # req = urllib.request.Request(APP_TEST_URL)
        # response = urllib.request.urlopen(req)  
        result = urllib.request.urlopen(APP_TEST_URL)
        response = result.read()
        print(response.decode('utf8'))
        print ('connection', APP_TEST_URL, ' http code:', response.getcode())  
        if(response.getcode() == 200):  
            print ('Success!')  
        else:  
            print ('Fail !!!')  
        response.close()
    except UnicodeDecodeError  as e:
        print('-----UnicodeDecodeError url:',APP_TEST_URL)  
    except urllib.error.URLError as e:
        print("-----urlError url:",APP_TEST_URL)  

if __name__ == '__main__':
	SSHClient()